#! /bin/sh
# cvssh - Login shell for people who should only have CVS access
# Gordon Matzigkeit <gord@fig.org>, 1999-12-02
#
# Modified for Codendi, dec 2002
#
# 
#

PATH=/usr/local/bin:/bin:/usr/bin
export CVSEDITOR=/bin/false

valid=no
status=1
if test $# -eq 2 && test "X$1" = X-c; then
 case "X$2" in
 'Xcvs server')
  # Actually run it.
  valid=yes
  $2
  ;;

 ## Add other commands as needed
 # ...
 esac
 status=$?
fi

if test $valid = no; then
 echo "You tried to execute: \`$0${1+ $@}'." 1>&2
 echo "Sorry, you are only allowed to execute : " 1>&2 
 echo "CVS_RSH=ssh; cvs commands" 1>&2 
fi

# This sleep is necessary to allow sshd to close the connection properly.
sleep 2
exit $status
